#include "common.h"
namespace common {
std::vector<int> findNumsAppearOnce(std::vector<int> &array) {
    int diff = 0;
    std::vector<int> result;
    for (auto e : array) {
        diff ^= e;
    }
    int mask_bit = 1;
    while ((mask_bit & diff) == 0) { // 找到第一个不同的bit位
        mask_bit = mask_bit << 1;
    }
    int a = 0, b = 0;
    for (auto e : array) {
        if (mask_bit & e) { // 根据不同的bit区分数据
            a = a ^ e;
        } else {
            b = b ^ e;
        }
    }
    result = {a, b};
    if (b < a)
        result = {b, a};
    return result;
}
} // namespace common
